/* 
 * jxListFiles Project (2014)
 * 
 * by Denilson Edinaldo Pinto
 * 
 * GPL
 * Copyright (C) 2014
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.jxListFiles.model;

import org.jxListFiles.RunJxListFiles;

import java.io.File;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Denilson Edinaldo Pinto
 * @porject jxListFiles
 * @package org.jxListFiles.model
 * @date 20/04/2014 - 10:55:57
 */
public final class Project implements Serializable {
	
	private static final long serialVersionUID = 2323004308629240481L;
	
	private String name;
	
	private File directory;
	
	private Date date;
	
	private List<String> extensions;
	
	private List<MyFile> values;
	
	/**
	 * 
	 */
	public Project() {
	
	}
	
	/**
	 * @param name
	 * @param directory
	 * @param date
	 * @param extensions
	 */
	public Project(String name, File directory, Date date, List<String> extensions) {
	
		this.name = name;
		this.directory = directory;
		this.date = date;
		this.extensions = extensions;
	}
	
	/**
	 * @param name
	 * @param directory
	 * @param extensions
	 */
	public Project(String name, File directory, List<String> extensions) {
	
		this(name, directory, new Date(), extensions);
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
	
		return name;
	}
	
	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
	
		this.name = name;
	}
	
	/**
	 * @return the directory
	 */
	public File getDirectory() {
	
		return directory;
	}
	
	/**
	 * @param directory
	 *            the directory to set
	 */
	public void setDirectory(File directory) {
	
		this.directory = directory;
	}
	
	/**
	 * @return the date
	 */
	public Date getDate() {
	
		return date;
	}
	
	/**
	 * @param date
	 *            the date to set
	 */
	public void setDate(Date date) {
	
		this.date = date;
	}
	
	/**
	 * @return the extensions
	 */
	public List<String> getExtensions() {
	
		return extensions;
	}
	
	/**
	 * @param extensions
	 *            the extensions to set
	 */
	public void setExtensions(List<String> extensions) {
	
		this.extensions = extensions;
	}
	
	/**
	 * @return the values
	 */
	public List<MyFile> getValues() {
	
		return values;
	}
	
	/**
	 * @param values
	 *            the values to set
	 */
	public void setValues(List<MyFile> values) {
	
		this.values = values;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
	
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
	
		if(this == obj) {
			return true;
		}
		if(obj == null) {
			return false;
		}
		if( !(obj instanceof Project)) {
			return false;
		}
		Project other = (Project)obj;
		if(name == null) {
			if(other.name != null) {
				return false;
			}
		}else if( !name.equals(other.name)) {
			return false;
		}
		return true;
	}
	
	/*
	 * (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
	
		return(name != null ? name + " - " + RunJxListFiles.getFormat().format(date): "");
	}
}
